17. RTAB-Map Memory Management
RTAB-Map Memory Management
RTAB-Map uses a memory management technique to limit the number of locations considered as candidates during loop closure detection. This technique is a key feature of RTAB-Map and allows for loop closure to be done in real time.
The overall strategy is to keep the most recent and frequently observed locations in the robot’s Working Memory (WM), and transfer the others into Long-Term Memory (LTM).
When a new image is acquired, a new node is created in the Short Term Memory (STM).
When creating a node, recall that features are extracted and compared to the vocabulary to find all of the words in the image, creating a bag-of-words for this node.
Nodes are assigned a weight in the STM based on how long the robot spent in the location - where a longer time means a higher weighting.
The STM has a fixed size of S. When STM reaches S nodes, the oldest node is moved to WM to be considered for loop closure detection.
Loop closure happens in the WM.
WM size depends on a fixed time limit T. When the time required to process new data reaches T, some nodes of graph are transferred from WM to LTM - as a result, WM size is kept nearly constant.
Oldest and less weighted nodes in WM are transferred to LTM before others, so WM is made up of nodes seen for longer periods of time.
LTM is not used for loop closure detection and graph optimization.
If loop closure is detected, neighbours in LTM of an old node can be transferred back to the WM (a process called retrieval).